package com.s08.e01.model;

public abstract class User extends Object {

	private String name;
	private String surname;
	private Address address;
	private Product[] card = new Product[10];

	public Product[] getCard() {
		return card;
	}

	public void setCard(Product[] card) {
		this.card = card;
	}

	public User(String name, String surname) {
		setName(name);
		setSurname(surname);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public void process() {
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	@Override
	public String toString() {
		return "User [name=" + name + ", surname=" + surname + ", address="
				+ address + "]";
	}

	public String showProducts() {

		Product[] products = getCard();
//		String result = null;
		String result = ""; // nie robic tak

		for (Product product : products) {

			if (product != null)

				result += "Product: " + product.showPrice()
						+ System.getProperty("line.separator");

		}

		return result == null ? "" : result;
	}

}
